﻿@{
    ViewBag.Title = "网站后台管理";
    var rolers = new List<ETA.Entity.Roler>();
    if (ViewBag.Rolers != null)
    {
        rolers = ViewBag.Rolers as List<ETA.Entity.Roler>;
    }
}

<h2><strong>网站后台管理</strong></h2>
<input type="hidden"  value="@ViewBag.FilePath" id="hiddenFilePath"/>
<div class="divRolerManager">
    <p class="rAdminStep">用户角色管理</p>
    <table class="table table-hover table-bordered" id="tbRolers">
        <thead>
            <tr>
                <th>角色ID</th>
                <th>角色名称</th>
                <th>状态</th>
                <th>备注说明</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var r in rolers)
            { 
                <tr>
                    <td>@r.RolerId</td>
                    <td>@r.RolerName</td>
                    <td>
                        @if (r.IsDelete)
                        {
                            <span>关闭</span>
                        }
                        else
                        {
                            <span>开启</span>
                        }
                    </td>
                    <td>@r.RoleDes</td>
                </tr>
            }
        </tbody>
    </table>
</div>

<div class="divUserManager">
    <p class="rAdminStep">用户管理</p>
    <p>
        <label for="FilterRolers">角色：</label>@Html.DropDownList("FilterRolers")
        <label for="FilterRolers">状态：</label>
        <select id="IsActive">
            <option value="-1">(全部)</option>
            <option value="true">启用</option>
            <option value="false">停用</option>
        </select>
        <button type="button" class="btn btn-primary" id="btnFilterUser">查询</button>
        <button type="button" class="btn btn-primary" id="btnOutPutUser">导出</button>
    </p>
    <p>
        <button type="button" class="btn btn-default btn-xs" id="btnAddUser">新增</button>
        <button type="button" class="btn btn-default btn-xs" id="btnEditUser">编辑</button>
        <button type="button" class="btn btn-default btn-xs" id="btnEnableUser">启用</button>
        <button type="button" class="btn btn-default btn-xs" id="btnDisenableUser">关闭</button>
    </p>
    <div>
        <table>
            <tr>
                <td>
                    <label>流程阶段选择：</label></td>
                <td style="text-align: left">@Html.DropDownList("flowStepList")</td>
                <td></td>
                <td rowspan="2"></td>
                <td rowspan="2">
            </tr>
            <tr>
                <td>
                    <label>状态变更时间：</label></td>
                <td>
                    <input type="text" id="FSdate" style="width: 210px; height: 23px; text-align: left" class="date_txt input_font Wdate" />~</td>
                <td>
                    <input type="text" id="FEdate" style="width: 210px; height: 23px" class="date_txt input_font Wdate" /></td>
                <td></td>
                <td></td>
            </tr>
        </table>
    </div>
    <div id="usersDivContainer">
        <table class="table table-hover table-bordered" id="tbUsers">
            <thead>
                <tr>
                    <th style="width: 59px;">
                        <input type="checkbox" id="checkUserAll" />全选</th>
                    <th>用户ID</th>
                    <th>用户名称</th>
                    <th>用户角色</th>
                    <th>状态</th>
                    <th>备注说明</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    </div>
    <br />
    <div id="pp" class="pagination"></div>
</div>
<div class="JoinManager">
    <p class="rAdminStep">企业加盟申请记录管理</p>
    <div class="joinManagerMenu">
        <p>
            <label for="JoinApplyTypeSel">国家分类：</label>
            <select id="JoinApplyTypeSel">
                <option value="0">全部</option>
                <option value="1">国内派遣机构</option>
                <option value="2">日本受入机构</option>
            </select>
        </p>
        <div id="InnerModel">
            <p>
                <label for="JoinApplyType">企业分类：</label>
                <select id="CompanyTypeCn" name="CompanyType">
                    <option selected="" value="">（企业分类）</option>
                    <option value="国有企业">国有企业</option>
                    <option value="集体企业">集体企业</option>
                    <option value="联营企业">联营企业</option>
                    <option value="股份合作制企业">股份合作制企业</option>
                    <option value="私营企业">私营企业</option>
                    <option value="有限责任公司">有限责任公司</option>
                    <option value="股份有限公司">股份有限公司</option>
                </select>
            </p>
            <p>
                <label>团体（企业）所在地：</label>
                <input type="hidden" name="AddressProviceCn" id="AddressProviceCn" />
                <input type="hidden" name="AddressCityCn" id="AddressCityCn" />
                <input type="hidden" name="AddressZoneCn" id="AddressZoneCn" class="notNeedInput" />
                <span id="spanProviceCity"></span>
                <input type="text" name="AddressSuffixCn" id="AddressSuffixCn" class="notNeedInput" />
            </p>
        </div>
        <div id="JapanModel">
            <p>
                <label for="JoinApplyType">日本团体分类：</label>
                <select id="CompanyTypeJapan" name="CompanyType">
                    <option selected="" value="">（全部）</option>
                    <option value="协同组合">协同组合</option>
                    <option value="企业单独型">企业单独型</option>
                    <option value="公益社团">公益社团</option>
                    <option value="公益财团">公益财团</option>
                    <option value="一般社团">一般社团</option>
                    <option value="一般财团">一般财团</option>
                    <option value="商工会">商工会</option>
                </select>
            </p>
            <p>
                <label>团体（企业）所在地：</label>
                <input type="hidden" name="AddressProviceJapan" id="AddressProviceJapan" />
                <input type="hidden" name="AddressCityJapan" id="AddressCityJapan" />
                <input type="hidden" name="AddressZoneJapan" id="AddressZoneJapan" class="notNeedInput" />
                <span id="spanProviceCityJapan"></span>
                <input type="text" name="AddressSuffixJapan" id="AddressSuffixJapan" class="notNeedInput" />
            </p>
        </div>
        <hr />
        <p>
            <label>团体（企业）全称：</label><input type="text" id="CompanyName" />
        </p>
        <p>
            <label>处理状态：</label>
            <select id="SelectHandlerState">
                <option value="">（全部）</option>
                <option value="0">审核中</option>
                <option value="1">成功加盟</option>
                <option value="2">恶意提交</option>
            </select>
        </p>
        <p>
            <label>提交日期:</label>
            <input type="text" id="SdateOfJoin" class="date_txt input_font Wdate" />
            ~<input type="text" id="EdateOfJoin" class="date_txt input_font Wdate" />
            <button type="button" class="btn btn-primary" id="btnFilterJoin">查询</button>
        </p>
    </div>
    <p>
        <button type="button" class="btn btn-default" id="btnHandleringApply">审核中</button>
        <button type="button" class="btn btn-danger" id="btnBadApply">恶意提交</button>
        <button type="button" class="btn btn-success" id="btnSuccessApply">成功加盟</button>
    </p>
    <div class="joinContainer">
        <div id="jDivContainer">
            <table class="table table-hover table-bordered" id="tbJoinLogs">
                <thead>
                    <tr>
                        <th>记录编号</th>
                        <th>团体（企业）分类</th>
                        <th>团体（企业）名称</th>
                        <th>团体（企业）地址</th>
                        <th>联系电话</th>
                        <th>企业邮箱</th>
                        <th>联系人</th>
                        <th>提交时间</th>
                        <th>附件下载</th>
                        <th>处理状态</th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
        <div id="pp3" class="pagination"></div>
    </div>
</div>
<div class="divQAManager">
    <p class="rAdminStep">网上咨询（Q&A）事务处理</p>
    <p>
        <label class="col-sm-2 control-label">提交日期:</label>
        <input type="text" id="Sdate" class="date_txt input_font Wdate" />
        ~<input type="text" id="Edate" class="date_txt input_font Wdate" />
        <button type="button" class="btn btn-primary" id="btnFilterQA">查询</button>
        <button type="button" class="btn btn-primary" id="btnFilterUnAnswer">罗列所有未回复的事物</button>
    </p>
    <div id="qasDivContainer">
        <table class="table table-hover table-bordered" id="tbQAs">
            <thead>
                <tr>
                    <th>事务编号</th>
                    <th>问题</th>
                    <th>提交人</th>
                    <th>提交时间</th>
                    <th>事物状态</th>
                    <th>答复人</th>
                    <th>答复时间</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    </div>
    <div id="pp2" class="pagination"></div>
</div>

<script id="QAAnswer-template" type="text/x-handlebars-template">
    <div id="divQaAnswer">
        <p>
            <label for="QuestionId" class="qaLabel">事物编号：</label>
            <span id="QuestionId">{{QuestionId}}</span>
        </p>
        <p>
            <label for="UserName" class="qaLabel">提交人：</label>
            <span id="UserName">{{UserName}}</span>
        </p>
        <p>
            <label for="CreateDate" class="qaLabel">提交时间：</label>
            <span id="CreateDate">{{CreateDate}}</span>
        </p>
        <div>
            <label for="QuestionContent" class="qaLabel" style="float: left">问题正文：</label>
            <div id="QuestionContent">{{QuestionContent}}</div>
        </div>
        <div class="clear"></div>
        <p>
            <label for="AnswerName" class="qaLabel">回复人：</label>
            <span id="AnswerName">{{AnswerName}}</span>
        </p>
        <p>
            <label for="AnswerTime" class="qaLabel">回复时间：</label>
            <span id="AnswerTime">{{AnswerTime}}</span>
        </p>
        <p>
            <label for="AnswerContent" class="qaLabel">回复正文：</label>
            <textarea id="AnswerContent">{{AnswerContent}}</textarea>
        </p>
        <p>
            <label class="qaLabel"></label>
            <button type="button" class="btn btn-primary" id="btnAnswerQA" data-qaid="{{QuestionId}}">回复</button>

            <button type="button" class="btn btn-default" id="btnCloseQA">关闭</button>
        </p>
    </div>
</script>

<script id="QA-template" type="text/x-handlebars-template">
    {{#each qas}}
            <tr data-qaid="{{QuestionId}}">
                <td>{{QuestionId}}</td>
                <td>{{QuestionContent}}</td>
                <td>{{UserName}}</td>
                <td>{{CreateDate}}</td>
                {{#if AnswerTime}} 
                      <td class="qaAnswer">已答复</td>
                {{else}}
                       <td class="qaUAnswer">未答复</td>
                {{/if}} 
                <td>{{AnswerName}}</td>
                <td>{{AnswerTime}}</td>
            </tr>
    {{/each}}
</script>

<script id="Join-template" type="text/x-handlebars-template">
    {{#each joins}}
            <tr data-joinapplyformid="{{JoinApplyFormId}}">
                <td>{{JoinApplyFormId}}</td>
                <td>{{JoinApplyTypeStr}}</td>
                <td>{{CompanyName}}</td>
                <td>{{FullAddress}}</td>
                <td>{{Telephone}}</td>
                <td>{{Email}}</td>
                <td>{{ContactPerson}}</td>
                <td>{{SubmitTime}}</td>
                <td>{{{FileLink}}}</td>
                <td>{{HandlerStatusStr}}</td>
            </tr>
    {{/each}}
</script>

<script id="UserAdd_template" type="text/x-handlebars-template">
    <div id="divUserAdd">
        <p>
            <label for="txtUserName" class="qaLabel">用户名：</label>
            <input id="txtUserName" name="txtUserName" style="width: 270px; height: 23px;" />
        </p>
        <p>
            <label for="rolers" class="qaLabel">角色：</label>
            @Html.DropDownList("FilterRolers")
        </p>
        <p>
            <label for="txtNote" class="qaLabel">备注：</label>
            <input id="txtNote" name="txtNote" style="width: 270px; height: 23px;" />
        </p>
        <p>
            <span class="" style="color: red; font-size: 10px">初始密码：@ViewBag.DefaultPassword</span>
            &nbsp;&nbsp;&nbsp;
            <button type="button" class="btn btn-primary" id="btnInsertUser">创建</button>&nbsp;&nbsp;
            <button type="button" class="btn btn-default" id="btnCloseAdduser">关闭</button>
        </p>
    </div>
</script>

<script id="UserEdit_template" type="text/x-handlebars-template">
    <div id="divUserEdit">
        <p>
            <label for="etxtUserName" class="qaLabel">用户Id：</label>
            <span>{{UserId}}</span>
        </p>
        <p>
            <label for="etxtUserName" class="qaLabel">用户名：</label>
            <input id="etxtUserName" name="etxtUserName" style="width: 270px; height: 23px;" value="{{UserName}}" />
        </p>
        <p>
            <label for="erolers" class="qaLabel">角色：</label>
            @Html.DropDownList("FilterRolers")
        </p>
        <p>
            <label for="etxtNote" class="qaLabel">备注：</label>
            <input id="etxtNote" name="etxtNote" style="width: 270px; height: 23px;" value="{{Note}}" />
        </p>
        <p>
            <label class="qaLabel"></label>
            <button type="button" class="btn btn-primary" id="btnModifyUser" data-userid="{{UserId}}">保存</button>&nbsp;&nbsp;
            <button type="button" class="btn btn-default" id="btnCloseEdituser">关闭</button>
        </p>
    </div>
</script>

<script id="UserAddForJoin_template" type="text/x-handlebars-template">
    <div id="divUserAddForJoin">
        <p>
            <label for="" class="JoinLabel">申请记录编号：</label>
            <span id="spanJoinApplyFormId">{{JoinApplyFormId}}</span>
        </p>
        <p>
            <label for="" class="JoinLabel">团体（企业）分类：</label>
            <span>{{JoinApplyTypeStr}}</span>
        </p>
        <p>
            <label for="" class="JoinLabel">团体（企业）名称：</label>
            <span>{{CompanyName}}</span>
        </p>
        <p>
            <label for="" class="JoinLabel">申请状态：</label>
            <span>{{HandlerStatusStr}}</span>
        </p>
        <hr />
        <p>
            <label for="etxtUserName" class="JoinLabel">用户名：</label>
            <input id="jtxtUserName" name="jtxtUserName" style="width: 270px; height: 23px;" value=" {{UserName}}" />
        </p>
        <p>
            <label for="erolers" class="JoinLabel">角色：</label>
            @Html.DropDownList("FilterRolers")
        </p>
        <p>
            <label for="jtxtNote" class="JoinLabel">备注：</label>
            <input id="jtxtNote" name="jtxtNote" style="width: 270px; height: 23px;" value=" {{NoteUser}}" />
        </p>
        <p>
            <span class="" style="color: red; font-size: 10px">初始密码：@ViewBag.DefaultPassword</span>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <button type="button" class="btn btn-primary" id="btnAddUserForJoin">创建</button>&nbsp;&nbsp;
            <button type="button" class="btn btn-primary" style="display:none" id="btnModifyUserForJoin" data-userid="{{UserId}}">保存</button>&nbsp;&nbsp;
            <button type="button" class="btn btn-default" id="btnCloseJuser">取消</button>
        </p>
    </div>
</script>

@section scripts
{
    @Scripts.Render("~/Bundles/chinaprovinces")
    @Scripts.Render("~/bundles/JSTmp")
    @Scripts.Render("~/bundles/Page")
    @Scripts.Render("~/bundles/WdatePicker")
    @Scripts.Render("~/bundles/WebAdmin")
}
